<template>
  <div class="TimeLimit">
    <div class="wrapper">
      <!-- 头部 star  -->
      <div class="head">限时特惠</div>
      <!-- 头部 end  -->

      <!-- 内容 star  -->
      <div class="main">
        <ul>
          <li v-for="item in limitime" :key="item.id" @click="information(item.productId,item.coverImageUrl)">
            <div class="img">
              <img :src="item.coverImageUrl" alt="" />
              <div class="location">{{item.districtName}}-{{item.hotelScenicName}}</div>
            </div>
            <p>
              {{item.packageName}}
            </p>
            <div class="price">
              <p>原价{{item.originPrice}}</p>
              <p>￥{{item.sellPrice}}起</p>
            </div>
          </li>
          
        </ul>
      </div>
      <!-- 内容 end  -->
    </div>
  </div>
</template>

<script>
import { getJsonlimitimeData } from "../api/limitime.js";
export default {
  data() {
    return {
      limitime:null,
    }
  },
  methods:{
    information(productId,productImg){
      this.$router.push("/details?back=/TimeLimit&productId="+productId+"&productImg="+productImg)
    },
  },
  created(){
    getJsonlimitimeData().then((data)=>{
      console.log(data.content.data);
      this.limitime=data.content.data
    })
  }
};
</script>

<style lang="scss" scoped>
.TimeLimit {
    background-color: rgb(251, 246, 233);
  .wrapper {
    min-width: 320px;
    max-width: 750px;
    margin: 0 auto;
    padding-bottom: 60px;
  }
  .head {
    font-size: 20px;
    color: rgb(153, 131, 79);
    text-align: center;
    background-color: #fff;
    height: 50px;
    line-height: 50px;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 10;
  }
  .main {
    margin: 16px;
    ul {
      li {
        background-color: #fff;
        border-radius: 8px;
        margin-bottom: 16px;
        .img {
          padding: 10px;
          position: relative;
          .location {
            font-size: 10px;
            color: #fff;
            position: absolute;
            bottom: 20px;
            left: 15px;
            background: url(../assets/img/ry.png) 10px center no-repeat;
            background-color: rgba(0, 0, 0, 0.295);
            padding: 5px 10px 5px 25px;
            border-radius: 15px;
          }
          img {
            width: 100%;
            height: 200px;
            border-radius: 6px;
          }
        }
        & > p {
          font-size: 14px;
          padding: 0 14px 14px;
          color: rgb(82, 69, 37);
        }
        .price {
          display: flex;
          justify-content: space-between;
          align-items: center;
          padding: 0 10px 15px;
          p {
            &:nth-child(1) {
              font-size: 12px;
              text-decoration: line-through;
              color: rgb(196, 186, 162);
            }
            &:nth-child(2) {
              background-color: rgb(249, 67, 67);
              height: 35px;
              line-height: 35px;
              padding: 0 10px;
              border-radius: 17px;
              font-size: 14px;
              color: #fff;
            }
          }
        }
      }
    }
  }
}
</style>